From 06351ff9665f4d449b8aa9788083de6f9a807a46 Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Sat, 4 May 2024 09:53:15 -0600 Subject: [PATCH] Move floor to Qt 6.2 (#1272) * move floor from Qt 5.15 to 6.2. * fix some CI failures * try harder to fix coverage build * try to fix coverage again * try agin * move up msvc tools minimum for Qt6 * clean up clazy warnings with Qt6. * drop redundnant CI job * revert translation related unintentionl changes * simplify find qt packages * assume Qt6 in textstream * move CI tidy to noble * assume Qt6 in textstream.h * remove obsolete makesetup.bat * remove Qt5 support from coretool * strip Qt5 from noble image * update default qt versions. * update minimum cmake version to match Qt 6.2.4 QT_SUPPORTED_MIN_CMAKE_VERSION_FOR_USING_QT * assume QHash result is type size_t * remove unnecessary qOverloads (in Qt6). --- .github/workflows/codacy-analysis.yaml | 4 +- .github/workflows/fedora.yml | 10 ---- .github/workflows/macos.yml | 2 +- .github/workflows/ubuntu.yml | 7 +-- .github/workflows/windows.yml | 26 +-------- CMakeLists.txt | 29 +++------- INSTALL | 3 +- csv_util.cc | 13 ++--- defs.h | 6 -- gdb.h | 19 +------ gui/CMakeLists.txt | 31 +++++------ gui/coretool/CMakeLists.txt | 17 +++--- gui/main.cc | 2 +- gui/mainwindow.cc | 12 +--- gui/makesetup.bat | 76 -------------------------- gui/runmachine.cc | 14 ++--- gui/runmachine.h | 15 ++--- igc.h | 2 +- inifile.cc | 6 +- main.cc | 6 +- mkshort.h | 2 +- smplrout.cc | 2 +- src/core/textstream.cc | 38 +------------ src/core/textstream.h | 12 ---- tools/Dockerfile_noble | 9 --- tools/ci_install_windows.sh | 2 +- tools/ci_setup_windows.ps1 | 2 +- trackfilter.cc | 14 ++--- xmldoc/chapters/build.xml | 3 +- 29 files changed, 81 insertions(+), 303 deletions(-) delete mode 100644 gui/makesetup.bat diff --git a/.github/workflows/codacy-analysis.yaml b/.github/workflows/codacy-analysis.yaml index acd19a832..1a33418ba 100644 --- a/.github/workflows/codacy-analysis.yaml +++ b/.github/workflows/codacy-analysis.yaml @@ -16,8 +16,8 @@ jobs: fail-fast: false matrix: include: - - IMAGE: 'jammy' - CMAKE_PREFIX_PATH: '/usr/lib/x86_64-linux-gnu/cmake/Qt5' + - IMAGE: 'noble' + CMAKE_PREFIX_PATH: '/usr/lib/x86_64-linux-gnu/cmake/Qt6' SCRIPT: './tools/ci_run_tidy.sh' container: image: gpsbabel-docker.jfrog.io/tsteven4/gpsbabel_build_environment_${{ matrix.IMAGE }} diff --git a/.github/workflows/fedora.yml b/.github/workflows/fedora.yml index 995ade4bc..f8a2aa553 100644 --- a/.github/workflows/fedora.yml +++ b/.github/workflows/fedora.yml @@ -14,22 +14,12 @@ jobs: fail-fast: false matrix: include: - - IMAGE: '35' - CMAKE_PREFIX_PATH: '/usr/lib64/cmake/Qt5' - - IMAGE: '37' - CMAKE_PREFIX_PATH: '/usr/lib64/cmake/Qt5' - IMAGE: '37' CMAKE_PREFIX_PATH: '/usr/lib64/cmake/Qt6' - - IMAGE: '38' - CMAKE_PREFIX_PATH: '/usr/lib64/cmake/Qt5' - IMAGE: '38' CMAKE_PREFIX_PATH: '/usr/lib64/cmake/Qt6' - - IMAGE: '39' - CMAKE_PREFIX_PATH: '/usr/lib64/cmake/Qt5' - IMAGE: '39' CMAKE_PREFIX_PATH: '/usr/lib64/cmake/Qt6' - - IMAGE: '40' - CMAKE_PREFIX_PATH: '/usr/lib64/cmake/Qt5' - IMAGE: '40' CMAKE_PREFIX_PATH: '/usr/lib64/cmake/Qt6' container: diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 3538c98fa..23b05ca83 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -18,7 +18,7 @@ jobs: fail-fast: false matrix: include: - - QT_VERSION: '5.15.2' + - QT_VERSION: '6.2.4' XCODE_VERSION: '13.4.1' GENERATOR: 'Ninja' RELEASE: false diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 4385a76ad..0e18db517 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -21,9 +21,6 @@ jobs: # focal has Qt 5.12, end of standard support 4/2025, end of life 4/2030. #- IMAGE: 'focal' # SCRIPT: './tools/build_and_test_cmake.sh' - - IMAGE: 'jammy' - CMAKE_PREFIX_PATH: '/usr/lib/x86_64-linux-gnu/cmake/Qt5' - SCRIPT: './tools/build_and_test_cmake.sh' - IMAGE: 'jammy' CMAKE_PREFIX_PATH: '/usr/lib/x86_64-linux-gnu/cmake/Qt6' SCRIPT: './tools/build_and_test_cmake.sh' @@ -39,7 +36,7 @@ jobs: SCRIPT: './tools/build_and_test_cmake.sh' TOOLS: 'clang' - IMAGE: 'jammy' - CMAKE_PREFIX_PATH: '/usr/lib/x86_64-linux-gnu/cmake/Qt5' + CMAKE_PREFIX_PATH: '/usr/lib/x86_64-linux-gnu/cmake/Qt6' SCRIPT: './tools/build_extra_tests.sh' container: image: gpsbabel-docker.jfrog.io/tsteven4/gpsbabel_build_environment_${{ matrix.IMAGE }} @@ -76,7 +73,7 @@ jobs: - name: install run: | sudo apt-get update - sudo apt-get install gcovr lcov libusb-1.0-0-dev qtbase5-dev qtwebengine5-dev libqt5serialport5-dev ninja-build + sudo apt-get install gcovr lcov libusb-1.0-0-dev libgl-dev qt6-base-dev libqt6core5compat6-dev libqt6serialport6-dev qt6-webengine-dev qt6-webengine-dev-tools ninja-build - name: Checkout repository uses: actions/checkout@v4 diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index ba596ce36..b37a74a0d 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -19,35 +19,11 @@ jobs: fail-fast: false matrix: include: - - QT_VERSION: '5.15.2' - ARCH: 'amd64' - HOST_ARCH: 'amd64' - COMPILER: 'msvc2019_64' - METHOD: 'aqt' - GENERATOR: 'Visual Studio 16 2019' - RELEASE: false - os: windows-2019 - - QT_VERSION: '5.15.2' - ARCH: 'amd64' - HOST_ARCH: 'amd64' - COMPILER: 'msvc2019_64' - TOOLSET: 'v141,version=14.16.27023' - METHOD: 'aqt' - GENERATOR: 'Visual Studio 16 2019' - RELEASE: false - os: windows-2019 - - QT_VERSION: '5.15.2' - ARCH: 'x86' - HOST_ARCH: 'amd64' - COMPILER: 'msvc2019' - METHOD: 'aqt' - GENERATOR: 'Visual Studio 16 2019' - RELEASE: false - os: windows-2019 - QT_VERSION: '6.2.4' ARCH: 'amd64' HOST_ARCH: 'amd64' COMPILER: 'msvc2019_64' + TOOLSET: 'v142,version=14.29.30133' METHOD: 'aqt' GENERATOR: 'Visual Studio 16 2019' RELEASE: false diff --git a/CMakeLists.txt b/CMakeLists.txt index 52cedd50a..55ac322d9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.11) +cmake_minimum_required(VERSION 3.16) include(CMakeDependentOption) include(CheckIncludeFile) @@ -26,17 +26,12 @@ set(CMAKE_AUTORCC ON) add_executable(gpsbabel) # Find the QtCore library -find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED) -find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED) -list(APPEND QT_LIBRARIES Qt${QT_VERSION_MAJOR}::Core) -if(${Qt${QT_VERSION_MAJOR}Core_VERSION} VERSION_LESS 5.15) - message(FATAL_ERROR "Qt version ${Qt${QT_VERSION_MAJOR}Core_VERSION} found, but version 5.15 or newer is required.") +find_package(Qt6 REQUIRED COMPONENTS Core Core5Compat) +list(APPEND QT_LIBRARIES Qt6::Core Qt6::Core5Compat) +if(${Qt6Core_VERSION} VERSION_LESS 6.2) + message(FATAL_ERROR "Qt version ${Qt6Core_VERSION} found, but version 6.2 or newer is required.") else() - message(STATUS "Using Qt${QT_VERSION_MAJOR} version ${Qt${QT_VERSION_MAJOR}Core_VERSION}") -endif() -if(${QT_VERSION_MAJOR} EQUAL "6") - find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core5Compat REQUIRED) - list(APPEND QT_LIBRARIES Qt${QT_VERSION_MAJOR}::Core5Compat) + message(STATUS "Using Qt6 version ${Qt6Core_VERSION}") endif() option(GPSBABEL_ENABLE_PCH "enable precompiled headers." ON) @@ -174,6 +169,7 @@ set(SUPPORT rgbcolors.cc route.cc session.cc + src/core/codecdevice.cc src/core/logging.cc src/core/nvector.cc src/core/textstream.cc @@ -187,9 +183,6 @@ set(SUPPORT waypt.cc xmlgeneric.cc ) -if(${QT_VERSION_MAJOR} EQUAL "6") - set(SUPPORT ${SUPPORT} src/core/codecdevice.cc) -endif() # HEADERS set(HEADERS @@ -267,6 +260,7 @@ set(HEADERS jeeps/gpsusbcommon.h jeeps/gpsusbint.h jeeps/gpsutil.h + src/core/codecdevice.h src/core/datetime.h src/core/file.h src/core/logging.h @@ -277,9 +271,6 @@ set(HEADERS src/core/xmlstreamwriter.h src/core/xmltag.h ) -if(${QT_VERSION_MAJOR} EQUAL "6") - set(HEADERS ${HEADERS} src/core/codecdevice.h) -endif() string(REPLACE .cc .h FILTER_HEADERS "${FILTERS}") set(HEADERS ${HEADERS} ${FILTER_HEADERS}) @@ -292,9 +283,7 @@ endif() if(WIN32) target_compile_definitions(gpsbabel PRIVATE __WIN32__) - if(${QT_VERSION_MAJOR} EQUAL "6") - qt_disable_unicode_defines(gpsbabel) - endif() + qt_disable_unicode_defines(gpsbabel) if(CMAKE_BUILD_TYPE STREQUAL Debug) target_compile_definitions(gpsbabel PRIVATE _DEBUG) endif() diff --git a/INSTALL b/INSTALL index f6ea5c7cb..8fe983de6 100644 --- a/INSTALL +++ b/INSTALL @@ -104,6 +104,5 @@ On non-macOS unix builds by default we now compile in the gpsbabel generated translation files, i.e. gpsbabelfe_*.qm, gpsbabel_*.qm, as well as gmapbase.html. When compiled in these files do not need to be distributed. These are used by the GUI. Additional translation files from Qt will also be -used if they are found. They may be in a package such as qttranslations5-l10n -or qt5-qttranslations. +used if they are found. They may be in a package such as qt6-translations-l10n. diff --git a/csv_util.cc b/csv_util.cc index 373e35556..1a7ad8420 100644 --- a/csv_util.cc +++ b/csv_util.cc @@ -20,7 +20,6 @@ */ -#include // for assert #include // for fabs #include // for strtod #include // for strlen, strchr, strncmp, strcmp, memmove, strcpy, strcspn, strncpy @@ -28,7 +27,7 @@ #include // for QByteArray #include // for QChar #include // for QDebug -#include // for QRegularExpression +#include // for QList #include // for QString, operator+ #include "defs.h" @@ -49,12 +48,10 @@ csv_stringclean(const QString& source, const QString& to_nuke) { QString r = source; if (!to_nuke.isEmpty()) { - // avoid problematic regular rexpressions, e.g. xmapwpt generated [:\n:], - // or one can imagine [0-9] when we meant the characters, '0', '-', and '9', - // or one can imagine [^a] when we meant the characters '^' and 'a'. - QRegularExpression regex = QRegularExpression(QStringLiteral("[%1]").arg(QRegularExpression::escape(to_nuke))); - assert(regex.isValid()); - r.remove(regex); + auto isNukeable = [&to_nuke](const QChar &ch)->bool { + return to_nuke.contains(ch); + }; + r.removeIf(isNukeable); } return r; } diff --git a/defs.h b/defs.h index 7604be2f1..93f2b5d0b 100644 --- a/defs.h +++ b/defs.h @@ -1022,10 +1022,4 @@ int color_to_bbggrr(const char* cname); constexpr double unknown_alt = -99999999.0; constexpr int unknown_color = -1; -#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) -using qhash_result_t = uint; -#else -using qhash_result_t = size_t; -#endif - #endif // DEFS_H_INCLUDED_ diff --git a/gdb.h b/gdb.h index fc3497401..d4797a45e 100644 --- a/gdb.h +++ b/gdb.h @@ -30,7 +30,6 @@ #include // for QString #include // for QStringView #include // for QVector -#include // for QT_VERSION, QT_VERSION_CHECK #include "defs.h" // for arglist_t, Waypoint, route_head, ARGTYPE_BOOL, ARGTYPE_INT, ARG_NOMINMAX, bounds, FF_CAP_RW_ALL, ff_cap, ff_type, ff_type_file #include "format.h" // for Format @@ -74,23 +73,9 @@ public: public: WptNamePosnKey(const QString& name, double lt, double ln) : shortname(name), lat(lt), lon(ln) {} - friend qhash_result_t qHash(const WptNamePosnKey &c, qhash_result_t seed = 0) noexcept + friend size_t qHash(const WptNamePosnKey &c, size_t seed = 0) noexcept { -#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) return qHashMulti(seed, c.shortname.toUpper(), c.lat, c.lon); -#else - /* - * As noted in above refeference - * QtPrivate::QHashCombine is private API, but does not require any special buildsystem magic; - * it’s in , a public header. - */ - QtPrivate::QHashCombine hash; - - seed = hash(seed, c.shortname.toUpper()); - seed = hash(seed, c.lat); - seed = hash(seed, c.lon); - return seed; -#endif } QString shortname; @@ -104,7 +89,7 @@ public: public: WptNameKey(const QString& name) : shortname(name) {} /* converting constructor */ - friend qhash_result_t qHash(const WptNameKey &c, qhash_result_t seed = 0) noexcept + friend size_t qHash(const WptNameKey &c, size_t seed = 0) noexcept { return qHash(c.shortname.toUpper(), seed); } diff --git a/gui/CMakeLists.txt b/gui/CMakeLists.txt index a64f6813a..04e095498 100644 --- a/gui/CMakeLists.txt +++ b/gui/CMakeLists.txt @@ -22,19 +22,18 @@ if(NOT UNIX OR APPLE) endif() # Find the QtCore library -find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED) -find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui Network SerialPort Widgets Xml REQUIRED) -list(APPEND QT_LIBRARIES Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::Network Qt${QT_VERSION_MAJOR}::SerialPort Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Xml) -if(${Qt${QT_VERSION_MAJOR}Core_VERSION} VERSION_LESS 5.15) - message(FATAL_ERROR "Qt version ${Qt${QT_VERSION_MAJOR}Core_VERSION} found, but version 5.15 or newer is required.") +find_package(Qt6 REQUIRED COMPONENTS Core Gui Network SerialPort Widgets Xml) +list(APPEND QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Network Qt6::SerialPort Qt6::Widgets Qt6::Xml) +if(${Qt6Core_VERSION} VERSION_LESS 6.2) + message(FATAL_ERROR "Qt version ${Qt6Core_VERSION} found, but version 6.2 or newer is required.") else() - message(STATUS "Using Qt${QT_VERSION_MAJOR} version ${Qt${QT_VERSION_MAJOR}Core_VERSION}") + message(STATUS "Using Qt6 version ${Qt6Core_VERSION}") endif() option(GPSBABEL_MAPPREVIEW "enable map preview." ON) if (GPSBABEL_MAPPREVIEW) - find_package(Qt${QT_VERSION_MAJOR} COMPONENTS WebEngineWidgets WebChannel REQUIRED) - list(APPEND QT_LIBRARIES Qt${QT_VERSION_MAJOR}::WebEngineWidgets Qt${QT_VERSION_MAJOR}::WebChannel) + find_package(Qt6 REQUIRED COMPONENTS WebEngineWidgets WebChannel) + list(APPEND QT_LIBRARIES Qt6::WebEngineWidgets Qt6::WebChannel) else() target_compile_definitions(gpsbabelfe PRIVATE DISABLE_MAPPREVIEW) endif() @@ -173,9 +172,9 @@ message(STATUS "Libs are: \"${LnkLibs}\"") get_target_property(IncDirs gpsbabelfe INCLUDE_DIRECTORIES) message(STATUS "Include Directores are: \"${IncDirs}\"") -find_package(Qt${QT_VERSION_MAJOR} QUIET COMPONENTS LinguistTools) -if (NOT Qt${QT_VERSION_MAJOR}LinguistTools_FOUND) - message(WARNING "Qt${QT_VERSION_MAJOR}LinguistTools not found, gpsbabelfe translations cannot be updated or released, and application cannot be packaged.") +find_package(Qt6 QUIET COMPONENTS LinguistTools) +if (NOT Qt6LinguistTools_FOUND) + message(WARNING "Qt6LinguistTools not found, gpsbabelfe translations cannot be updated or released, and application cannot be packaged.") else() # FIXME: translations updated and released in source directory (and under version control). list(APPEND TRANSLATIONS gpsbabelfe_de.ts) @@ -186,19 +185,19 @@ else() list(APPEND TRANSLATIONS gpsbabelfe_ru.ts) add_custom_target(gpsbabelfe_lupdate - COMMAND Qt${QT_VERSION_MAJOR}::lupdate ${SOURCES} ${FORMS} -ts ${TRANSLATIONS} + COMMAND Qt6::lupdate ${SOURCES} ${FORMS} -ts ${TRANSLATIONS} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} VERBATIM USES_TERMINAL) add_custom_target(gpsbabelfe_lrelease - COMMAND Qt${QT_VERSION_MAJOR}::lrelease ${TRANSLATIONS} + COMMAND Qt6::lrelease ${TRANSLATIONS} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DEPENDS gpsbabelfe_lupdate VERBATIM USES_TERMINAL) if(APPLE) - get_target_property(_qmake_executable Qt${QT_VERSION_MAJOR}::qmake IMPORTED_LOCATION) + get_target_property(_qmake_executable Qt6::qmake IMPORTED_LOCATION) add_custom_target(package_app COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/package_app -a $ -q ${_qmake_executable} -g $ -s ${CMAKE_CURRENT_SOURCE_DIR} COMMAND ${CMAKE_COMMAND} -E copy $/../GPSBabelFE.dmg ${CMAKE_CURRENT_BINARY_DIR} @@ -206,7 +205,7 @@ else() VERBATIM USES_TERMINAL) elseif(UNIX) - get_target_property(_qmake_executable Qt${QT_VERSION_MAJOR}::qmake IMPORTED_LOCATION) + get_target_property(_qmake_executable Qt6::qmake IMPORTED_LOCATION) add_custom_target(package_app COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/package_app -a $ -q ${_qmake_executable} -g $ -s ${CMAKE_CURRENT_SOURCE_DIR} DEPENDS gpsbabelfe gpsbabel gpsbabelfe_lrelease coretool_lrelease @@ -220,7 +219,7 @@ else() endif() # in 5.12.12 cmake doesn't know about windeployqt, look in directory that has qmake. - get_target_property(_qmake_executable Qt${QT_VERSION_MAJOR}::qmake IMPORTED_LOCATION) + get_target_property(_qmake_executable Qt6::qmake IMPORTED_LOCATION) get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY) find_program(WINDEPLOYQT NAMES windeployqt PATHS "${_qt_bin_dir}" NO_DEFAULT_PATH) if (WINDEPLOYQT STREQUAL "WINDEPLOYQT-NOTFOUND") diff --git a/gui/coretool/CMakeLists.txt b/gui/coretool/CMakeLists.txt index dbe37b739..aa3df9a0c 100644 --- a/gui/coretool/CMakeLists.txt +++ b/gui/coretool/CMakeLists.txt @@ -4,9 +4,8 @@ endif() add_executable(coretool EXCLUDE_FROM_ALL) -find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED) -find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Widgets REQUIRED) -list(APPEND QT_LIBRARIES Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Widgets) +find_package(Qt6 REQUIRED COMPONENTS Core Widgets) +list(APPEND QT_LIBRARIES Qt6::Core Qt6::Widgets) list(APPEND SOURCES ../formatload.cc) list(APPEND SOURCES coretool.cc) @@ -22,7 +21,7 @@ target_link_libraries(coretool ${QT_LIBRARIES}) # FIXME: core_strings.h generated in source directory (and under version control). # FIXME: translations updated and released in source directory (and under version control). -get_target_property(_qmake_executable Qt${QT_VERSION_MAJOR}::qmake IMPORTED_LOCATION) +get_target_property(_qmake_executable Qt6::qmake IMPORTED_LOCATION) get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY) add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/core_strings.h COMMAND ${CMAKE_COMMAND} -E copy $ ${CMAKE_CURRENT_BINARY_DIR} @@ -39,26 +38,26 @@ list(APPEND TRANSLATIONS gpsbabel_hu.ts) list(APPEND TRANSLATIONS gpsbabel_it.ts) list(APPEND TRANSLATIONS gpsbabel_ru.ts) -find_package(Qt${QT_VERSION_MAJOR} QUIET COMPONENTS LinguistTools) -if(Qt${QT_VERSION_MAJOR}LinguistTools_FOUND) +find_package(Qt6 QUIET COMPONENTS LinguistTools) +if(Qt6LinguistTools_FOUND) # The line numbers are almost meaningless the way we generate corestrings.h, and we force everything to the same context. # With line numbers and the similartext heuristic enabled translations can be copied from an old message to a new message, # and marked as unfinished. The threshold for similar is low. # These will be used by the application, even though they really need to be checked. # Disable the similartext heuristic to avoid these mistranslations. add_custom_target(coretool_lupdate - COMMAND Qt${QT_VERSION_MAJOR}::lupdate -disable-heuristic similartext core_strings.h -ts ${TRANSLATIONS} + COMMAND Qt6::lupdate -disable-heuristic similartext core_strings.h -ts ${TRANSLATIONS} DEPENDS core_strings.h WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} VERBATIM USES_TERMINAL) add_custom_target(coretool_lrelease - COMMAND Qt${QT_VERSION_MAJOR}::lrelease ${TRANSLATIONS} + COMMAND Qt6::lrelease ${TRANSLATIONS} DEPENDS coretool_lupdate WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} VERBATIM USES_TERMINAL) else() - message(WARNING "Qt${QT_VERSION_MAJOR}LinguistTools not found, coretool translations cannot be updated or released.") + message(WARNING "Qt6LinguistTools not found, coretool translations cannot be updated or released.") endif() diff --git a/gui/main.cc b/gui/main.cc index 6ad489aa8..84b08c1fe 100644 --- a/gui/main.cc +++ b/gui/main.cc @@ -32,7 +32,7 @@ int main(int argc, char** argv) // MIN_QT_VERSION in GPSBabel.pro should correspond to the QT_VERSION_CHECK // arguments in main.cc and gui/main.cc and the version check in // CMakeLists.txt, gui/CMakeLists.txt. -#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0)) +#if (QT_VERSION < QT_VERSION_CHECK(6, 2, 0)) #error this version of Qt is not supported. #endif diff --git a/gui/mainwindow.cc b/gui/mainwindow.cc index 21352c239..054169a4c 100644 --- a/gui/mainwindow.cc +++ b/gui/mainwindow.cc @@ -178,13 +178,9 @@ MainWindow::MainWindow(QWidget* parent): QMainWindow(parent) connect(ui_.actionUpgradeCheck, &QAction::triggered, this, &MainWindow::upgradeCheckActionX); connect(ui_.actionPreferences, &QAction::triggered, this, &MainWindow::preferencesActionX); -// TODO: Qt6 deleted the obsolete overloaded signal QComboBox::currentIndexChanged(const QString &text) -// that required using qOverload. - connect(ui_.inputFormatCombo, qOverload(&QComboBox::currentIndexChanged), + connect(ui_.inputFormatCombo, &QComboBox::currentIndexChanged, this, &MainWindow::inputFormatChanged); -// TODO: Qt6 deleted the obsolete overloaded signal QComboBox::currentIndexChanged(const QString &text) -// that required using qOverload. - connect(ui_.outputFormatCombo, qOverload(&QComboBox::currentIndexChanged), + connect(ui_.outputFormatCombo, &QComboBox::currentIndexChanged, this, &MainWindow::outputFormatChanged); connect(ui_.inputOptionsBtn, &QAbstractButton::clicked, this, &MainWindow::inputOptionButtonClicked); @@ -270,11 +266,7 @@ void MainWindow::switchTranslator(QTranslator& translator, const QString& filena const QStringList directories = { QApplication::applicationDirPath() + "/translations", ":/translations", -#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) - QLibraryInfo::location(QLibraryInfo::TranslationsPath) -#else QLibraryInfo::path(QLibraryInfo::TranslationsPath) -#endif }; // Load the new translator. diff --git a/gui/makesetup.bat b/gui/makesetup.bat deleted file mode 100644 index 08531a67a..000000000 --- a/gui/makesetup.bat +++ /dev/null @@ -1,76 +0,0 @@ -rem $Id: makesetup.bat,v 1.2 2010-06-27 21:13:07 robertl Exp $ -rem -rem Copy the Qt stuff into a local directory. The Inno Setup compiler -rem cannot handle %QTDIR environment variable in the source file -rem specification - -echo off -rd /q /s qtdir -mkdir qtdir -mkdir qtdir\bin -mkdir qtdir\translations -mkdir qtdir\plugins -mkdir qtdir\plugins\imageformats -mkdir qtdir\plugins\platforms -mkdir qtdir\mingw - -rem Basic Qt runtime DLLs -rem if "%QTDIR%"=="" call \QtSDK\Desktop\Qt\4.7.4\mingw\bin\qtenv2.bat -rem if "%QTDIR%"=="" call \Qt\Qt5.2.1\5.2.1\mingw48_32\bin\qtenv2.bat -if "%QTDIR%"=="" set QTDIR=c:\Qt\Qt5.2.1\5.2.1\mingw48_32 -copy %QTDIR%\bin\icu*.dll qtdir\bin -copy %QTDIR%\bin\libgcc_s_dw2-1.dll qtdir\bin -copy %QTDIR%\bin\libstdc*.dll qtdir\bin -copy %QTDIR%\bin\libwinpthread*.dll qtdir\bin -copy %QTDIR%\bin\Qt5Core.dll qtdir\bin -copy %QTDIR%\bin\Qt5Gui.dll qtdir\bin -copy %QTDIR%\bin\Qt5Multimedia.dll qtdir\bin -copy %QTDIR%\bin\Qt5MultimediaWidgets.dll qtdir\bin -copy %QTDIR%\bin\Qt5Network.dll qtdir\bin -copy %QTDIR%\bin\Qt5OpenGL.dll qtdir\bin -copy %QTDIR%\bin\Qt5Positioning.dll qtdir\bin -copy %QTDIR%\bin\Qt5PrintSupport.dll qtdir\bin -copy %QTDIR%\bin\Qt5Qml.dll qtdir\bin -copy %QTDIR%\bin\Qt5Quick.dll qtdir\bin -copy %QTDIR%\bin\Qt5Sensors.dll qtdir\bin -copy %QTDIR%\bin\Qt5Sql.dll qtdir\bin -copy %QTDIR%\bin\Qt5Webkit.dll qtdir\bin -copy %QTDIR%\bin\Qt5WebkitWidgets.dll qtdir\bin -copy %QTDIR%\bin\Qt5Widgets.dll qtdir\bin -copy %QTDIR%\bin\Qt5Xml.dll qtdir\bin - -rem Image format plugins needed at runtime, but not debug verions -xcopy %QTDIR%\plugins\imageformats qtdir\plugins\imageformats -xcopy %QTDIR%\plugins\platforms qtdir\plugins\platforms -rem del qtdir\plugins\imageformats\*d4*.dll -rem del qtdir\plugins\imageformats\lib*d4*.a - -rem Mingw runtime support -copy %QTDIR%\..\mingw\bin\mingwm10.dll qtdir\mingw - -rem Copy QT's own translations (Apply/OK, and the like) -copy %QTDIR%\translations\qt_*.qm qtdir\translations -del qtdir\translations\qt_help* - -rem Generate the compiled translations. All of this makes sense only if -rem the you're doing releases strictly -rem copy %QTDIR%\translations\qt_*.ts qtdir\translations -rem lrelease gpsbabel_de.ts -rem lrelease gpsbabel_es.ts -rem lrelease gpsbabel_fr.ts -rem lrelease gpsbabel_hu.ts -rem lrelease gpsbabel_it.ts -rem lrelease gpsbabelfe_de.ts -rem lrelease gpsbabelfe_es.ts -rem lrelease gpsbabelfe_fr.ts -rem lrelease gpsbabelfe_hu.ts -rem lrelease gpsbabelfe_it.ts -rem lrelease gpsbabelfe_ru.ts -rem for /f %%a in (dir /b *.ts) do lrelease %%a - -"c:\Program Files\Inno Setup 5\ISCC.exe" setup.iss - -rem cleanup -rd /q /s qtdir -rem del gpsbabel_*.qm -rem del gpsbabelfe_*.qm diff --git a/gui/runmachine.cc b/gui/runmachine.cc index 80465a5c6..7633a06aa 100644 --- a/gui/runmachine.cc +++ b/gui/runmachine.cc @@ -19,13 +19,12 @@ #include "runmachine.h" -#include // for qDebug -#include // for QEventLoop -#include // for QNonConstOverload -#include // for QOverload, qOverload -#include // for QDialog +#include // for operator<<, QDebug +#include // for QEventLoop +#include // for QueuedConnection +#include // for qDebug -#include "appname.h" // for appName +#include "appname.h" // for appName QString RunMachine::decodeProcessError(QProcess::ProcessError err) @@ -64,8 +63,7 @@ RunMachine::RunMachine(QWidget* parent, std::nullopt, std::nullopt); }, Qt::QueuedConnection); - // TODO: Qt6 combined the obsolete overloaded signal QProcess::finished(int exitCode) - connect(process_, qOverload(&QProcess::finished), + connect(process_, &QProcess::finished, this, [this](int exitCode, QProcess::ExitStatus exitStatus) { execute(processFinished, std::nullopt, diff --git a/gui/runmachine.h b/gui/runmachine.h index ff3104b52..a5330f29e 100644 --- a/gui/runmachine.h +++ b/gui/runmachine.h @@ -20,15 +20,16 @@ #ifndef RUNMACHINE_H #define RUNMACHINE_H -#include // for QObject -#include // for QProcess, QProcess::ExitStatus, QProcess::ProcessError, qt_getEnumName -#include // for QString -#include // for QStringList -#include // for QWidget +#include // for QList +#include // for Q_ENUM, Q_OBJECT, Q_SIGNALS +#include // for QProcess, QProcess::ProcessError, QProcess::ExitStatus +#include // for QString +#include // for QStringList +#include // for QWidget -#include // for optional, nullopt +#include // for optional -#include "processwait.h" // for ProcessWaitDialog +#include "processwait.h" // for ProcessWaitDialog class RunMachine : public QWidget diff --git a/igc.h b/igc.h index 51019a348..ba291d167 100644 --- a/igc.h +++ b/igc.h @@ -83,7 +83,7 @@ public: // Qt5 doesn't have a qHash function for scoped enumerations. // Qt6 falls back to std::hash, but it may not use the seed. - friend qhash_result_t qHash(const igc_ext_type_t& key, qhash_result_t seed = 0) noexcept + friend size_t qHash(const igc_ext_type_t& key, size_t seed = 0) noexcept { return qHash(static_cast::type>(key), seed); } diff --git a/inifile.cc b/inifile.cc index be1e28a70..bae2d49ae 100644 --- a/inifile.cc +++ b/inifile.cc @@ -29,7 +29,7 @@ #include // for QHash #include // for QIODevice::ReadOnly, QIODevice #include // for QTextStream -#include // for qEnvironmentVariable, qPrintable, QT_VERSION, QT_VERSION_CHECK +#include // for qEnvironmentVariable, qPrintable #include #define MYNAME "inifile" @@ -191,11 +191,7 @@ inifile_init(const QString& filename, const char* myname) gpsbabel::File file(name); file.open(QFile::ReadOnly); QTextStream stream(&file); -#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) - // default for QTextStream::setCodec in Qt5 is QTextCodec::codecForLocale() // default for QTextStream::setEncoding in Qt6 is QStringConverter::Utf8 - stream.setCodec("UTF-8"); -#endif stream.setAutoDetectUnicode(true); auto* result = new inifile_t; diff --git a/main.cc b/main.cc index 21cafdee1..690950b4a 100644 --- a/main.cc +++ b/main.cc @@ -738,12 +738,12 @@ main(int argc, char* argv[]) // MIN_QT_VERSION in GPSBabel.pro should correspond to the QT_VERSION_CHECK // arguments in main.cc and gui/main.cc and the version check in // CMakeLists.txt, gui/CMakeLists.txt. -#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0)) +#if (QT_VERSION < QT_VERSION_CHECK(6, 2, 0)) #error This version of Qt is not supported. #endif -#if defined(_MSC_VER) && (_MSC_VER < 1910) /* MSVC 2015 or earlier */ -#error MSVC 2015 and earlier are not supported. Please use MSVC 2017 or MSVC 2019. +#if defined(_MSC_VER) && (_MSC_VER < 1920) /* MSVC 2017 or earlier */ +#error MSVC 2017 and earlier are not supported. Please use MSVC 2019 or MSVC 2022. #endif if constexpr (DEBUG_LOCALE) { diff --git a/mkshort.h b/mkshort.h index 8086adfc3..1fe2c02d7 100644 --- a/mkshort.h +++ b/mkshort.h @@ -60,7 +60,7 @@ private: public: ShortNameKey(const QByteArray& name) : shortname(name) {} /* converting constructor */ - friend qhash_result_t qHash(const ShortNameKey& key, qhash_result_t seed = 0) noexcept + friend size_t qHash(const ShortNameKey& key, size_t seed = 0) noexcept { // We hash all strings as upper case. return qHash(key.shortname.toUpper(), seed); diff --git a/smplrout.cc b/smplrout.cc index 0e5985ec4..77bdcdc1f 100644 --- a/smplrout.cc +++ b/smplrout.cc @@ -209,7 +209,7 @@ void SimplifyRouteFilter::routesimple_head(const route_head* rte) neighborhood goner = errormap.last(); goner.wpt->wpt_flags.marked_for_deletion = 1; // errormap.remove(lastKey()); // with Qt 5.12.12, 5.15.2 results in asan heap-use-after-free errors in build_extra_tests.sh - errormap.erase(std::prev(errormap.end())); // in Qt6 can use cend(). + errormap.erase(std::prev(errormap.cend())); // in Qt6 can use cend(). // wpthash.remove(goner.wpt); // removal not necessary /* recompute neighbors of point marked for deletion. */ diff --git a/src/core/textstream.cc b/src/core/textstream.cc index a4a899ec4..e3a62cdae 100644 --- a/src/core/textstream.cc +++ b/src/core/textstream.cc @@ -18,22 +18,16 @@ */ -#include // for qint64, QT_VERSION, QT_VERSION_CHECK +#include // for qint64 -#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) #include // for QByteArrayView -#endif #include // for QFile #include // for QFlags #include // for QIODevice -#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) #include // for QIODeviceBase::OpenMode #include // for QStringConverter, QStringConverter::Utf8, QStringConverter::Encoding, QStringConverter::Utf16 -#endif -#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) #include // for optional -#endif #include "defs.h" // for fatal, list_codecs #include "src/core/textstream.h" @@ -45,31 +39,6 @@ namespace gpsbabel void TextStream::open(const QString& fname, QIODevice::OpenMode mode, const char* module, const char* codec_name) { -#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) - codec_ = QTextCodec::codecForName(codec_name); - if (codec_ == nullptr) { - list_codecs(); - fatal("%s: Unsupported codec '%s'.\n", module, codec_name); - } - - file_ = new gpsbabel::File(fname); - file_->open(mode); - setDevice(file_); - setCodec(codec_); - - if (mode & QFile::ReadOnly) { - if (codec_->mibEnum() == 106) { // UTF-8 - setAutoDetectUnicode(true); - } - } - - if (mode & QFile::WriteOnly) { - // enable bom for all UTF codecs except UTF-8 - if (codec_->mibEnum() != 106) { - setGenerateByteOrderMark(true); - } - } -#else std::optional encoding = QStringConverter::encodingForName(codec_name); bool use_stringconverter = encoding.has_value(); @@ -116,7 +85,6 @@ void TextStream::open(const QString& fname, QIODevice::OpenMode mode, const char setDevice(device_); setEncoding(QStringConverter::Utf16); } -#endif } void TextStream::close() @@ -127,15 +95,11 @@ void TextStream::close() delete file_; file_ = nullptr; } -#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) - codec_ = nullptr; -#else if (device_ != nullptr) { device_->close(); delete device_; device_ = nullptr; } -#endif } } // namespace gpsbabel diff --git a/src/core/textstream.h b/src/core/textstream.h index 52aa59667..93f09bbfe 100644 --- a/src/core/textstream.h +++ b/src/core/textstream.h @@ -19,21 +19,13 @@ #ifndef SRC_CORE_TEXTSTREAM_INCLUDED_H_ #define SRC_CORE_TEXTSTREAM_INCLUDED_H_ -#include // for QT_VERSION, QT_VERSION_CHECK #include // for QIODevice -#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) #include // for QIODeviceBase::OpenMode -#endif #include // for QString -#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) -#include // for QTextCodec -#endif #include // for QTextStream -#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) #include "src/core/codecdevice.h" // for CodecDevice -#endif #include "src/core/file.h" // for File @@ -48,11 +40,7 @@ public: private: gpsbabel::File* file_{nullptr}; -#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) - QTextCodec* codec_{nullptr}; -#else gpsbabel::CodecDevice* device_{nullptr}; -#endif }; } // namespace gpsbabel diff --git a/tools/Dockerfile_noble b/tools/Dockerfile_noble index 498f1ac39..41065517d 100644 --- a/tools/Dockerfile_noble +++ b/tools/Dockerfile_noble @@ -58,15 +58,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ libudev-dev \ && rm -rf /var/lib/apt/lists/* -# pkgs with qt used by gpsbabel -RUN apt-get update && apt-get install -y --no-install-recommends \ - qtbase5-dev \ - qttools5-dev \ - qttranslations5-l10n \ - qtwebengine5-dev \ - libqt5serialport5-dev \ - && rm -rf /var/lib/apt/lists/* - # pkgs with qt used by gpsbabel RUN apt-get update && apt-get install -y --no-install-recommends \ qt6-base-dev \ diff --git a/tools/ci_install_windows.sh b/tools/ci_install_windows.sh index 9c4e379d1..ad8fd5023 100755 --- a/tools/ci_install_windows.sh +++ b/tools/ci_install_windows.sh @@ -18,7 +18,7 @@ function validate() { ) } -QT_VERSION=${1:-5.15.2} +QT_VERSION=${1:-6.5.3} COMPILER=${2:-msvc2019_64} METHOD=${3:-default} diff --git a/tools/ci_setup_windows.ps1 b/tools/ci_setup_windows.ps1 index 73791c747..4c38b28e9 100755 --- a/tools/ci_setup_windows.ps1 +++ b/tools/ci_setup_windows.ps1 @@ -7,7 +7,7 @@ # and https://github.com/microsoft/vswhere/wiki/Start-Developer-Command-Prompt Param( - [string] $qtdir = "C:\Qt\Qt5.15.2\5.15.2\msvc2019_64", + [string] $qtdir = "C:\Qt\6.5.3\msvc2019_64", [ValidateSet("x86", "amd64")][string] $arch = "amd64", [ValidateSet("x86", "amd64")][string] $host_arch = "amd64", [string] $vcversion diff --git a/trackfilter.cc b/trackfilter.cc index 708032496..f9ee348f9 100644 --- a/trackfilter.cc +++ b/trackfilter.cc @@ -359,8 +359,8 @@ void TrackFilter::trackfilter_merge() QList buff; - auto it = track_list.begin(); - while (it != track_list.end()) { /* put all points into temp buffer */ + auto it = track_list.cbegin(); + while (it != track_list.cend()) { /* put all points into temp buffer */ route_head* track = *it; // steal all the wpts WaypointList wpts; @@ -377,9 +377,9 @@ void TrackFilter::trackfilter_merge() delete wpt; } } - if (it != track_list.begin()) { + if (it != track_list.cbegin()) { track_del_head(track); - it = track_list.erase(it); + it = static_cast(track_list.erase(it)); } else { ++it; } @@ -714,8 +714,8 @@ void TrackFilter::trackfilter_range() int original_waypt_count = track_waypt_count(); - auto it = track_list.begin(); - while (it != track_list.end()) { + auto it = track_list.cbegin(); + while (it != track_list.cend()) { route_head* track = *it; foreach (Waypoint* wpt, track->waypoint_list) { @@ -739,7 +739,7 @@ void TrackFilter::trackfilter_range() if (track->rte_waypt_empty()) { track_del_head(track); - it = track_list.erase(it); + it = static_cast(track_list.erase(it)); } else { ++it; } diff --git a/xmldoc/chapters/build.xml b/xmldoc/chapters/build.xml index 83434456e..de92ffa54 100644 --- a/xmldoc/chapters/build.xml +++ b/xmldoc/chapters/build.xml @@ -373,8 +373,7 @@ On non-macOS unix builds by default we now compile in the gpsbabel generated translation files, i.e. gpsbabelfe_*.qm, gpsbabel_*.qm, as well as gmapbase.html. When compiled in these files do not need to be distributed. These are used by the GUI. Additional translation files from Qt will also be -used if they are found. They may be in a package such as qttranslations5-l10n -or qt5-qttranslations. +used if they are found. They may be in a package such as qt6-translations-l10n. -- 2.30.2